package com.web.base.log.dao;

import com.blue.jdbc.BaseDao;
import com.web.base.log.model.Accusation;
import org.springframework.stereotype.Repository;

/**
 * 举报数据库访问
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2018年06月20日
 */
@Repository("logAccusationDao")
public class AccusationDao extends BaseDao<Accusation>
{
	public AccusationDao()
	{
	}
	
	@Override
	protected void query(StringBuilder sql, Accusation param)
	{
		if (param != null)
		{
			if (param.getUserId() != null && param.getUserId() > 0)
				sql.append(" and a.user_id=:userId");
				
			if (param.getState() != null)
				sql.append(" and a.state=:state");
				
			if (param.getExternalId() != null && param.getExternalId() > 0)
				sql.append(" and a.external_id=:externalId");
				
			if (param.getExternalType() != null)
				sql.append(" and a.external_type=:externalType");
				
		}
		sql.append(" order by a.id desc");
	}
	
}
